﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using DAL;
using Models;

namespace BLL
{
    public class UserTeamRoleManager
    {
        private UserTeamRoleService objUserTeamRoleService = new UserTeamRoleService();
        /// <summary>
        /// 新增用户信息
        /// </summary>
        /// <param name="userName"></param>
        /// <param name="displayName"></param>
        /// <param name="email"></param>
        /// <returns></returns>
        public int InsertUserInfo(string userName, string displayName, string email)
        {
            int result = objUserTeamRoleService.GetUserName(userName);
            if (result == 0)
            {
                result = objUserTeamRoleService.InsertUserInfo(userName, displayName, email);
            }
            return result;
        }
        /// <summary>
        /// 查询用户所在的所有团队
        /// </summary>
        /// <param name="userName"></param>
        /// <returns></returns>
        public List<UserTeamRole> GetUserTeam(string userName)
        {
            return objUserTeamRoleService.GetUserTeam(userName);
        }
        /// <summary>
        /// 根据团队、角色、工作流ID查询用户
        /// </summary>
        /// <param name="teamId"></param>
        /// <param name="roleId"></param>
        /// <param name="workMouldId"></param>
        /// <returns></returns>
        public List<UserInfo> GetUserInfo(int teamId, int roleId, int workMouldId)
        {
            return objUserTeamRoleService.GetUserInfo(teamId, roleId, workMouldId);
        }
        /// <summary>
        /// 组合查询权限
        /// 需要参数：工作流名称或用户姓名
        /// 返回结果：姓名 团队 角色 工作流名称列表
        /// </summary>
        /// <param name="workflowName"></param>
        /// <param name="displayName"></param>
        /// <returns></returns>
        public List<UserTeamRole> GetUserInfo(string workflowName, string displayName)
        {
            return objUserTeamRoleService.GetUserInfo(workflowName, displayName);
        }
        /// <summary>
        /// 组合查询权限
        /// 需要参数：工作流模板Id 用户名 角色Id
        /// 返回结果：符合条件的数量
        /// </summary>
        /// <param name="userName"></param>
        /// <param name="roleId"></param>
        /// <param name="workMouldId"></param>
        /// <returns></returns>
        public int GetUserInfo(string userName, int roleId, int workMouldId)
        {
            return objUserTeamRoleService.GetUserInfo(userName, roleId, workMouldId);
        }
        /// <summary>
        /// 组合查询权限
        /// 需要参数：工作流模板Id 用户名 团队Id
        /// 返回结果：符合条件的数量
        /// </summary>
        /// <param name="userName"></param>
        /// <param name="roleId"></param>
        /// <param name="workMouldId"></param>
        /// <returns></returns>
        public int GetUserInfoTeam(string userName, int teamId, int workMouldId)
        {
            return objUserTeamRoleService.GetUserInfoTeam(userName, teamId, workMouldId);
        }
    }
}
